﻿
//using System;
//using System.ServiceModel;
//using System.ServiceModel.Discovery;
//namespace EasyComm.Hosting.Configuration
//{
//    internal static class AdminConfiguration
//    {
//        internal static void ApplyConfiguration(ServiceHost serviceHost, Type serviceType, Type[] serviceContractList, Uri[] baseAddresses, string ns = "http://www.tempuri.org/")
//        {
//            if (serviceHost == null)
//            {
//                return;
//            }
//            //ContractDescription desc = ContractDescription.GetContract(contractType);

//            #region main endpoints
//            for (int i = 0; i < baseAddresses.Length; i++)
//            {
//                foreach (Type serviceContract in serviceContractList)
//                {
//                    //ContractDescription desc = ContractDescription.GetContract(serviceContract, serviceType);
//                    //ServiceEndpoint mainEndPoint = new ServiceEndpoint(desc, GenericConfiguration.GetMainBinding(), new EndpointAddress(baseAddresses[i]));
//                    //ServiceEndpoint mainEndPoint = new ServiceEndpoint(desc, GenericConfiguration.GetMainBinding(), new EndpointAddress(serviceContract.Name));
//                    //mainEndPoint.Name = string.Format("{0}_{1}_MainEndpoint_{2}", serviceType.Name, serviceContract.Name, i);
//                    //serviceHost.AddServiceEndpoint(mainEndPoint);
//                    serviceHost.AddServiceEndpoint(serviceContract, GenericConfiguration.GetMainBinding(), serviceContract.Name);
//                }
//            }
//            #endregion

//            ServiceDiscoveryBehavior discoveryBehavior = new ServiceDiscoveryBehavior();
//            discoveryBehavior.AnnouncementEndpoints.Add(new UdpAnnouncementEndpoint());
//            serviceHost.Description.Behaviors.Add(discoveryBehavior);
//            serviceHost.AddServiceEndpoint(new UdpDiscoveryEndpoint() { Name = "udpDiscoveryEndPoint" });

//            //general
//            GenericConfiguration.SetupMex(serviceHost, serviceType, "adminMexUrl");
//            GenericConfiguration.SetupDebugging(serviceHost);
//        }
//    }
//}
